#include <bits/stdc++.h>
using namespace std;
int num[1000001];
const int mod = 1000000007;
int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> num[i];
  }
  int ans = 0;
  for (int i = 1; i <= n; i++) {
    for (int j = i + 1; j <= n; j++) {
      int k = (num[i] + num[j]) % mod;
      int pingfang = (k * k) % mod;
      (ans += pingfang) %= mod;
    }
  }
  cout << ans;
  return 0;
}